<?php 
class calendarComponents extends sfComponents
{
	public function executeVisible()
	{
		/* @var $calendar CalendarEntry */
		$this->arVisibleRoles = array();
		$this->arRoles = MyConstants::getRolesList();
		if($this->calendar)
		{
			$arr = split(':', $this->calendar->getUserRoles());
			$array = array();
			foreach ($arr as $v=>$k)
			{
				$array[$k] = $k;
			}
			$this->arVisibleRoles = $array;
		}
	}
	
	public function executePublicity()
	{
		$arrReturn = array();
		$arRoles = MyConstants::getRolesList();
//		if( $this->calendar->getIsPublic() == 1 )
//		{
//			$arrReturn[] = sfContext::getInstance()->getI18N()->__('All');
//		}else 
//		{
		$arr = split(':', $this->calendar->getUserRoles());
		foreach ($arr as $value)
		{
			if(!empty($arRoles[$value]))
			{
				$arrReturn[] = sfContext::getInstance()->getI18N()->__($arRoles[$value]);
			}
		}
//		}
		$this->arr = $arrReturn;
	}
}